<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">
<link href="style.css" type="text/css" rel="stylesheet">
<title>FXAM—Examine Floating-Point </title></head>
<body>
<h1>FXAM—Examine Floating-Point</h1>
<table>
<tr>
<th>Opcode</th>
<th>Instruction</th>
<th>64-Bit Mode</th>
<th>Compat/Leg Mode</th>
<th>Description</th></tr>
<tr>
<td>D9 E5</td>
<td>FXAM</td>
<td>Valid</td>
<td>Valid</td>
<td>Classify value or number in ST(0).</td></tr></table>
<h2>Description</h2>
<p>Examines the contents of the ST(0) register and sets the condition code flags C0, C2, and C3 in the FPU status word to indicate the class of value or number in the register (see the table below).</p>
<h3>Table 3-42.  FXAM Results</h3>
<p>.</p>
<table>
<tr>
<th>Class</th>
<th>C3</th>
<th>C2</th>
<th>C0</th></tr>
<tr>
<td>Unsupported</td>
<td>0</td>
<td>0</td>
<td>0</td></tr>
<tr>
<td>NaN</td>
<td>0</td>
<td>0</td>
<td>1</td></tr>
<tr>
<td>Normal finite number</td>
<td>0</td>
<td>1</td>
<td>0</td></tr>
<tr>
<td>Infinity</td>
<td>0</td>
<td>1</td>
<td>1</td></tr>
<tr>
<td>Zero</td>
<td>1</td>
<td>0</td>
<td>0</td></tr>
<tr>
<td>Empty</td>
<td>1</td>
<td>0</td>
<td>1</td></tr>
<tr>
<td>Denormal number</td>
<td>1</td>
<td>1</td>
<td>0</td></tr></table>
<p>The C1 flag is set to the sign of the value in ST(0), regardless of whether the register is empty or full.</p>
<p>This instruction’s operation is the same in non-64-bit modes and 64-bit mode.</p>
<h2>Operation</h2>
<pre>C1 ← sign bit of ST; (* 0 for positive, 1 for negative *)
CASE (class of value or number in ST(0)) OF
    Unsupported:C3, C2, C0 ← 000;
    NaN:
                    C3, C2, C0 ← 001;
    Normal:
                    C3, C2, C0 ← 010;
    Infinity:
                    C3, C2, C0 ← 011;
    Zero:
                    C3, C2, C0 ← 100;
    Empty:
                    C3, C2, C0 ← 101;
    Denormal:
                    C3, C2, C0 ← 110;
ESAC;</pre>
<h2>FPU Flags Affected</h2>
<table class="exception-table">
<tr>
<td>C1</td>
<td>Sign of value in ST(0).</td></tr>
<tr>
<td>C0, C2, C3</td>
<td>See Table 3-42.</td></tr></table>
<h2>Floating-Point Exceptions</h2>
<p>None</p>
<h2>Protected Mode Exceptions</h2>
<table class="exception-table">
<tr>
<td>#NM</td>
<td>CR0.EM[bit 2] or CR0.TS[bit 3] = 1.</td></tr>
<tr>
<td>#MF</td>
<td>If there is a pending x87 FPU exception.</td></tr>
<tr>
<td>#UD</td>
<td>If the LOCK prefix is used.</td></tr></table>
<h2>Real-Address Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p>
<h2>Virtual-8086 Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p>
<h2>Compatibility Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p>
<h2>64-Bit Mode Exceptions</h2>
<p>Same exceptions as in protected mode.</p></body></html>